﻿<%@ Page Language="C#" MasterPageFile="~/Site.master" CodeFile="Details.aspx.cs" Inherits="Details" %>



<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:DynamicDataManager ID="DynamicDataManager1" runat="server" AutoLoadForeignKeys="true" />

    <h2>Entry from table <%= table.DisplayName %></h2>

    <asp:ScriptManagerProxy runat="server" ID="ScriptManagerProxy1" />

    <asp:ValidationSummary ID="ValidationSummary1" runat="server" EnableClientScript="true"
        HeaderText="List of validation errors" />
    <asp:DynamicValidator runat="server" ID="DetailsViewValidator" ControlToValidate="DetailsView1" Display="None" />

    <br /><br />

    <asp:DetailsView ID="DetailsView1" runat="server" DataSourceID="DetailsDataSource" OnItemDeleted="DetailsView1_ItemDeleted">
        <Fields>
            <asp:TemplateField>
                <ItemTemplate>
                    <asp:HyperLink ID="EditHyperLink" runat="server"
                        NavigateUrl='<%# table.GetActionPath(PageAction.Edit, GetDataItem()) %>'
                        Text="Edit" />
                    <asp:LinkButton ID="DeleteLinkButton" runat="server" CommandName="Delete" CausesValidation="false"
                        OnClientClick='return confirm("Are you sure you want to delete this item?");'
                        Text="Delete" />
                </ItemTemplate>
            </asp:TemplateField>
        </Fields>
    </asp:DetailsView>

    <asp:LinqDataSource ID="DetailsDataSource" runat="server" EnableDelete="true">
        <WhereParameters>
            <asp:DynamicQueryStringParameter />
        </WhereParameters>
    </asp:LinqDataSource>

    <br />

    <asp:HyperLink ID="ListHyperLink" runat="server">Show all items</asp:HyperLink>
</asp:Content>
